package com.lanou3g.code0410;

/**
 * If there are no bugs, it was created by Chen FengYao on 2018/4/10;
 * Otherwise, I don't know who created it either
 */
// 多态
public class Test02 {
    public static void main(String[] args) {
        // 父类引用 指向子类对象
        //      ---- 多态
        Animal animal0 = new Animal();
        Cat cat = new Cat();


        Animal animal2 = new Dog();

        Dog dog = (Dog) animal2;// 向下转型
        Animal a = dog;
        dog.lookDoor();

        Animal animal3 = new EnglishShortCat();
        Cat c = (Cat) animal3;
        EnglishShortCat e = (EnglishShortCat)c;

        Zoo zoo = new Zoo();
        zoo.feed(animal0);
        zoo.feed(cat);
        zoo.feed(animal2);
        zoo.feed(animal3);
    }
}
